<%@page language="java" import="java.io.BufferedReader" %>
<%@page language="java" import="java.io.PrintWriter" %>
<%@page language="java" import="java.io.File" %>
<%@page language="java" import="java.io.FileOutputStream" %>
<%@page language="java" import="sun.misc.BASE64Decoder" %>
<%@page language="java" import="java.net.URLDecoder" %>
<%
	
	String imagem=URLDecoder.decode(request.getParameter("image"), "UTF-8");
	imagem=imagem.substring(22);
	imagem=imagem.replaceAll(" ", "+");
	
	try{
 		
		BASE64Decoder decoder = new BASE64Decoder();
		byte[] decodedBytes = decoder.decodeBuffer(imagem.trim());
		FileOutputStream osf = new FileOutputStream(new File("/home/user/fotos/meuteste.png"));  
		osf.write(decodedBytes);  
		osf.flush(); 
	} catch(Exception e) {
	   e.printStackTrace();
	}
	
%>

   

